const { exec } = require('child_process');

module.exports = {
    execScript(scriptContent, cwd) {
        return new Promise((resolve, reject) => {
            exec(scriptContent, { cwd },  (error, stdout, stderr) => {
                if(error){
                    reject({
                        code: 'NACK',
                        message: error.message
                    });
                }
                return resolve({
                    code: 'ACK'
                });
            });
        })
    }
};